﻿namespace UniFrame
{
    /// <summary>
    /// 资源信息
    /// </summary>
    public class UniRes
    {
        /// <summary>
        /// 资源信息
        /// </summary>
        /// <param name="path"></param>
        public UniRes(string path)
        {
            Path = path;
            Name = path.Substring(path.LastIndexOf("/") + 1);
        }
        /// <summary>
        /// 存放路径
        /// </summary>
        public string Path { get; private set; }
        /// <summary>
        /// 资源名字
        /// </summary>
        public string Name { get; private set; }
        /// <summary>
        /// 返回资源路径的哈希值
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            return Path.GetHashCode();
        }
        /// <summary>
        /// 资源路径是否一致
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            UniRes target = obj as UniRes;
            return Path.Equals(target.Path);     
        }
        /// <summary>
        /// 返回资源路径
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return Path;
        }
    }
}
